import dayjs from "dayjs";

export const searchItemList: Array<SuperSearch.SearchItem> = [
  {
    type: "input",
    label: "文件名称",
    keyName: "exportName"
  },
  {
    type: "select",
    label: "状态",
    keyName: "status",
    optConfig: {
      label: "label",
      value: "value"
    },
    options: [
      {
        label: "等待中",
        value: 1
      },
      {
        label: "导出中",
        value: 2
      },
      {
        label: "导出成功",
        value: 3
      },
      {
        label: "导出失败",
        value: 4
      },
      {
        label: "取消",
        value: 0
      }
    ]
  }
];

export const tableColumn: Array<SuperTable.TableCoulmnItem | SuperTable.NestTableColumnItem> = [
  {
    type: "checkbox",
    field: "checkbox",
    minWidth: "50"
  },
  {
    field: "exportName",
    title: "文件名称",
    minWidth: "150"
  },
  {
    field: "status",
    title: "状态",
    minWidth: "100",
    renderSlot: "status"
  },
  {
    field: "createTime",
    title: "提交时间",
    minWidth: "100",
    formatter: ({ cellValue }: any) => {
      if (cellValue) return dayjs(Number(cellValue)).format("YYYY-MM-DD HH:mm:ss");
      else return "-";
    }
  },
  {
    field: "updateTime",
    title: "导出时间",
    minWidth: "100",
    formatter: ({ cellValue }: any) => {
      if (cellValue) return dayjs(Number(cellValue)).format("YYYY-MM-DD HH:mm:ss");
      else return "-";
    }
  },
  {
    field: "createName",
    title: "创建人",
    minWidth: "140"
  },
  {
    field: "failReason",
    title: "失败原因",
    minWidth: "140"
  },
  {
    field: "action",
    title: "操作",
    minWidth: "140",
    fixed: "right",
    renderSlot: "action"
  }
];
